home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / library / reqtlsdv.lha / ReqTools / doc / windowptr.readme < prev   
Text File  |  1993-08-25  |  1KB  |  48 lines

  1.  
  2. All requesters in the Requester Toolkit check the pr_WindowPtr of your
  3. process to find the screen they should open on.
  4.  
  5. These code fragments show you how to set/restore the pr_WindowPtr of your
  6. process.
  7.  
  8. -----------------------------------------------------------------------------
  9.  
  10. ...
  11. struct Window *win;
  12. struct Process *myproc;
  13. APTR oldwinptr;
  14.  
  15. main()
  16. {
  17.    myproc = (struct Process *)FindTask (NULL);
  18.    /* get old window pointer */
  19.    oldwinptr = myproc->pr_WindowPtr;
  20.    ...
  21.    /* Open your screen */
  22.    ...
  23.    /* Open window on your screen */
  24.    win = OpenWindow (&newwindow);
  25.    if (!win) FreeExit();
  26.    /* change the window pointer */
  27.    myproc->pr_WindowPtr = win;
  28.    ...
  29.    /* now all requesters from the Requester Toolkit will appear
  30.       on the screen your window is on. */
  31.    ...
  32. }
  33.  
  34. -----------------------------------------------------------------------------
  35. In 'FreeExit()' you MUST restore the old windowptr before closing your
  36. window and exiting!
  37. -----------------------------------------------------------------------------
  38.  
  39. FreeExit()
  40. {
  41.    ...
  42.    /* restore old window pointer before closing window */
  43.    myproc->pr_WindowPtr = oldwinptr;
  44.    if (win) CloseWindow (win);
  45.    ...
  46.    exit (0);
  47. }
  48.